/**
 * @file 74HC4051.h
 * @brief 八选一模拟IO复用
 * @author wangh (wanghuan3037@fiberhome.com)
 * @version 1.0
 * @date 2021-03-10
 * @copyright Copyright (c) 2021  烽火通信
 */
#ifndef __74HC4051_H
#define __74HC4051_H 
#include <stdbool.h>
#include "bsp_gpio.h"


/**
 * @brief HC4051对象结构体
 */
typedef struct Hc4051_s
{
    Gpio_t A0;          ///< 复用输入选择控制A0
    Gpio_t A1;          ///< 复用输入选择控制A1
    Gpio_t A2;          ///< 复用输入选择控制A2
    Gpio_t EN;          ///< 复用输入使能

    bool IsInitialized; ///< 是否初始化a0
} Hc4051_t;


int8_t HC4051_Init( Hc4051_t *obj, PinNames pin_a0, PinNames pin_a1, PinNames pin_a2, PinNames pin_en );

void HC4051_DeInit( Hc4051_t *obj );

int8_t HC4051_Select( Hc4051_t *obj, uint8_t Yn );


#endif	 // __74HC4051_H 

/*********** (C) COPYRIGHT 2021 FiberHome *****END OF FILE****/
